package com.qiaoyanqing.ximalaya.discovermodule.discover_adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.qiaoyanqing.ximalaya.discovermodule.discover_entity.Discover_ClassifySecondBookTabEntity;
import com.qiaoyanqing.ximalaya.discovermodule.discover_fragment.Discover_ClassifySecondBaseFragment;

import java.util.List;

/**
 * Created by hp on 2016/12/12.
 */

public class Discover_ClassifySecondVPAdapter extends FragmentPagerAdapter {

    private List<Discover_ClassifySecondBookTabEntity.ListEntity> tabList;
    private String categoryId;

    public Discover_ClassifySecondVPAdapter(FragmentManager fm,List<Discover_ClassifySecondBookTabEntity.ListEntity> tabList,String categoryId) {
        super(fm);
        this.tabList = tabList;
        this.categoryId = categoryId;
    }

    @Override
    public Fragment getItem(int position) {
        return Discover_ClassifySecondBaseFragment.newInstance(tabList.get(position).getTname(),tabList.get(position).getTname(),categoryId);
    }

    @Override
    public int getCount() {
        return tabList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabList.get(position).getTname();
    }
}
